package com.bowen.gulimall.thirdpatry.controller;

import com.bowen.common.utils.R;
import com.bowen.gulimall.thirdpatry.component.SmsComponent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sms")
public class SmsSendController {
    @Autowired
    private SmsComponent smsComponent;

    /**
     * 当前接口是提供给后台服务的使用，并不是直接的调用
     *
     * @param phone
     * @param code  这个是后台生成的，所以需要
     * @return
     */
    @GetMapping("/sendcode")
    public R sendCode(@RequestParam("phone") String phone, @RequestParam("code") String code) {
        smsComponent.sendSmsCode(phone, code);
        return R.ok();
    }
}
